class EtapasController < ApplicationController
  # GET /etapas
  # GET /etapas.xml
  def index
    @etapas = Etapa.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @etapas }
    end
  end

  # GET /etapas/1
  # GET /etapas/1.xml
  def show
    @etapa = Etapa.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @etapa }
    end
  end

  # GET /etapas/new
  # GET /etapas/new.xml
  def new
    @etapa = Etapa.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @etapa }
    end
  end

  # GET /etapas/1/edit
  def edit
    @etapa = Etapa.find(params[:id])
  end

  # POST /etapas
  # POST /etapas.xml
  def create
    @etapa = Etapa.new(params[:etapa])

    respond_to do |format|
      if @etapa.save
        flash[:notice] = 'Etapa was successfully created.'
        format.html { redirect_to(@etapa) }
        format.xml  { render :xml => @etapa, :status => :created, :location => @etapa }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @etapa.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /etapas/1
  # PUT /etapas/1.xml
  def update
    @etapa = Etapa.find(params[:id])

    respond_to do |format|
      if @etapa.update_attributes(params[:etapa])
        flash[:notice] = 'Etapa was successfully updated.'
        format.html { redirect_to(@etapa) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @etapa.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /etapas/1
  # DELETE /etapas/1.xml
  def destroy
    @etapa = Etapa.find(params[:id])
    @etapa.destroy

    respond_to do |format|
      format.html { redirect_to(etapas_url) }
      format.xml  { head :ok }
    end
  end
end
